package common_class.Demo01;

/**
 * @Author Miku
 * @Create 2021/4/10 15:35
 */
public class Application {
    public static void main(String[] args) {
        //Object.getClass()方法
        Student s1 = new Student("miku",16);
        Student s2 = new Student("yae sakura",18);
        //判断s1和s2是不是同一个类型
        Class class1 = s1.getClass();
        Class class2 = s2.getClass();
        if (class1 == class2) {
            System.out.println("s1和s2属于同一个类型");
        }else {
            System.out.println("s1和s2不属于同一个类型");
        }

        //Object.hashCode()方法
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());
        Student s3 = s1;
        System.out.println(s3.hashCode());

        //Object.toString()方法
        System.out.println(s1.toString());
        System.out.println(s2.toString());

        //Object.equals()方法
        System.out.println(s1.equals(s2));

        Student aaa = new Student("aaa", 10);
        Student bbb = new Student("aaa", 10);
        System.out.println(aaa.equals(bbb));

    }
}
